/**
 * \* Created with IntelliJ IDEA.
 * \* User: 冯若航
 * \* Date: 2021/7/10
 * \* Time: 18:52
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class 四键键盘 {
    public int maxA(int n) {
        int[] dp=new int[n+1];
        dp[0]=0;
        for(int i=1;i<=n;i++){
            //这次按A键
            dp[i]=dp[i-1]+1;
            //这次按C-V键
            for(int j=2;j<i;j++){
                //全选并复制dp[j-2]，连续粘贴i-j次
                //屏幕上共dp[j-2]*(i-j+1)个A
                dp[i]=Math.max(dp[i],dp[j-2]*(i-j+1));
            }
        }
        return dp[n];
    }
}